package com.wjw;

import com.wjw.enums.AnimeTypeEnum;
import com.wjw.factory.AnimeFactory;

/**
 * 动漫制作公司
 *
 * @author ikaros
 * @date 2024-07-19 00:52:26
 * @see <a href="ikaros@qq.com">mailTo: ikaros@qq.com</a>
 */
public class AnimeProductionCompany {

    private AnimeFactory factory;

    public AnimeFactory getFactory() {
        return factory;
    }

    public void setFactory(AnimeFactory factory) {
        this.factory = factory;
    }

    /**
     * 生产动漫
     *
     * @return {@link BaseAnime} - 仅在没有该类型时候返回 null
     */
    public BaseAnime productAnime() {
        if (factory == null) {
            throw new RuntimeException("创建动漫对象失败, 请提供工厂对象");
        }
        // 创建动漫产品对象
        BaseAnime anime = factory.createAnime();
        // 作画配乐
        anime.draw();
        anime.music();
        return anime;
    }
}
